﻿
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utils.Common;
using ZK.Entity.Config;

namespace ZK.BLL.Config
{

    [Serializable]
    public class SystemConfig : ConfigBase
    {

        private static SystemConfig systemConfig;
        public static SystemConfig GetConfig()
        {
            if (systemConfig == null)
            {
                systemConfig = ConfigHelper.BackSerialize(new SystemConfig());
                if (systemConfig == null)
                {
                    systemConfig = new SystemConfig();
                }
                if (systemConfig.SystemInfoEntity == null) systemConfig.SystemInfoEntity=new SystemInfoEntity();
                
            }
            return systemConfig;
        }

        [NonSerialized]
        public EventHandler SystemConfigEditHandler;

        //修改 
        public bool EditConfig()
        {
            try
            {
                ConfigHelper.Serialize(systemConfig);
                if (SystemConfigEditHandler != null)
                {
                    SystemConfigEditHandler(this, null);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
   


        
        public string RegisterInfo { get; set; }

        /// <summary>
        /// 系统配置信息
        /// </summary>
        /// 

        public SystemInfoEntity SystemInfoEntity { get; set; } = new SystemInfoEntity();


 
    }

}
